package com.angel.crowd.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author yuzhen
 * @create 2020-05-10 22:43
 */
@Configuration
public class CrowdWebMvcConfig implements WebMvcConfigurer{

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        // 浏览器访问的地址
        String urlPathReg = "/auth/member/to/reg/page";
        String urlPathLogin = "/auth/member/to/login/page";
        String urlPathCenter = "/auth/member/to/center/page";
        String urlPathCrowd = "/member/my/crowd";


        // 目标视图的名称，将来拼接“prefix: classpath:/templates/”、“suffix: .html”前后缀
        String viewNameReg = "member-reg";
        String viewNameLogin = "member-login";
        String viewNameCenter = "member-center";
        String viewNameCrowd =  "member-crowd";


        // 添加view-controller
        registry.addViewController(urlPathReg).setViewName(viewNameReg);
        registry.addViewController(urlPathLogin).setViewName(viewNameLogin);
        registry.addViewController(urlPathCenter).setViewName(viewNameCenter);
        registry.addViewController(urlPathCrowd).setViewName(viewNameCrowd);

    }
}
